//
//  ShapeDemo.swift
//  firstFontAttrDemo
//
//  Created by liy on 2025/1/20.
//

import SwiftUI

struct ShapeDemo: View {
  var body: some View {
    VStack {
      // 1.颜色
      Color.red

      // 2.矩形
      Rectangle()
        .fill(.green)
        //					.stroke(.blue, style: StrokeStyle(lineWidth: 5, lineCap: .round, lineJoin: .round, miterLimit: 200, dash: [5,20], dashPhase: 112))
        .strokeBorder(.blue, style: StrokeStyle(lineWidth: 10, lineCap: .square, lineJoin: .round, dash: [5, 20]))
      // 圆角矩形+不规则圆角矩形
      RoundedRectangle(cornerRadius: 10) // 圆角矩形
      UnevenRoundedRectangle(cornerRadii: RectangleCornerRadii(topLeading: 60)) // 不规则圆角矩形

      // 3.圆
      Circle()
        .trim(from: 0.5, to: 0.9) // 裁切
        .size(CGSize(width: 150, height: 150))
			
      // 4.胶囊
      Capsule()
        .scale(0.6, anchor: .topTrailing) // 缩放
        .rotation(Angle(degrees: 30)) // 旋转
        .offset(CGSize(width: -10, height: -50)) // 平移
				
    }
    .padding(20)
  }
}

#Preview {
  ShapeDemo()
}
